# eric7.WebBrowser.History.HistoryMenu

Module implementing the history menu.

### Global Attributes

None

### Classes

HistoryMenu | Class implementing the history menu.
HistoryMenuModel | Class implementing a model for the history menu.
HistoryMostVisitedMenu | Class implementing the most visited history menu.
HistoryMostVisitedMenuModel | Class implementing a model to show the most visited history entries.

### Functions

None

## HistoryMenu

Class implementing the history menu.

### Signals

newBackgroundTab(QUrl, str)
  emitted to open a URL in a new background tab
newPrivateWindow(QUrl, str)
  emitted to open a URL in a new private window
newTab(QUrl, str)
  emitted to open a URL in a new tab
newWindow(QUrl, str)
  emitted to open a URL in a new window
openUrl(QUrl, str)
  emitted to open a URL in the current tab

### Derived from

EricModelMenu

### Class Attributes

None

### Class Methods

None

### Methods

HistoryMenu | Constructor
__aboutToShowClosedTabsMenu | Private slot to populate the closed tabs menu.
__activated | Private slot handling the activated signal.
__clearHistoryDialog | Private slot to clear the history.
__closedTabAvailable | Private slot to handle changes of the availability of closed tabs.
postPopulated | Public method to add any actions after the tree.
prePopulated | Public method to add any actions before the tree.
setInitialActions | Public method to set the list of actions that should appear first in the menu.
showHistoryDialog | Public slot to show the history dialog.

### Static Methods

None

#### HistoryMenu (Constructor)

HistoryMenu(mainWindow=None, tabWidget=None)

Constructor

mainWindow (WebBrowserWindow)
  reference to the main browser window object
tabWidget (WebBrowserTabWidget)
  reference to the tab widget managing the browser tabs

#### HistoryMenu.__aboutToShowClosedTabsMenu

__aboutToShowClosedTabsMenu()

Private slot to populate the closed tabs menu.

#### HistoryMenu.__activated

__activated(idx)

Private slot handling the activated signal.

idx (QModelIndex)
  index of the activated item

#### HistoryMenu.__clearHistoryDialog

__clearHistoryDialog()

Private slot to clear the history.

#### HistoryMenu.__closedTabAvailable

__closedTabAvailable(avail)

Private slot to handle changes of the availability of closed tabs.

avail (bool)
  flag indicating the availability of closed tabs

#### HistoryMenu.postPopulated

postPopulated()

Public method to add any actions after the tree.

#### HistoryMenu.prePopulated

prePopulated()

Public method to add any actions before the tree.

Return:
  flag indicating if any actions were added

Return Type:
  bool

#### HistoryMenu.setInitialActions

setInitialActions(actions)

Public method to set the list of actions that should appear first in the menu.

actions (list of QAction)
  list of initial actions

#### HistoryMenu.showHistoryDialog

showHistoryDialog()

Public slot to show the history dialog.

Up

## HistoryMenuModel

Class implementing a model for the history menu.

It maps the first bunch of items of the source model to the root.

### Derived from

QAbstractProxyModel

### Class Attributes

MOVEDROWS

### Class Methods

None

### Methods

HistoryMenuModel | Constructor
bumpedRows | Public method to determine the number of rows moved to the root.
columnCount | Public method to get the number of columns.
index | Public method to create an index.
mapFromSource | Public method to map an index to the proxy model index.
mapToSource | Public method to map an index to the source model index.
mimeData | Public method to return the mime data.
parent | Public method to get the parent index.
rowCount | Public method to determine the number of rows.

### Static Methods

None

#### HistoryMenuModel (Constructor)

HistoryMenuModel(sourceModel, parent=None)

Constructor

sourceModel (QAbstractItemModel)
  reference to the source model
parent (QObject)
  reference to the parent object

#### HistoryMenuModel.bumpedRows

bumpedRows()

Public method to determine the number of rows moved to the root.

Return:
  number of rows moved to the root

Return Type:
  int

#### HistoryMenuModel.columnCount

columnCount(parent=None)

Public method to get the number of columns.

parent (QModelIndex)
  index of parent

Return:
  number of columns

Return Type:
  int

#### HistoryMenuModel.index

index(row, column, parent=None)

Public method to create an index.

row (int)
  row number for the index
column (int)
  column number for the index
parent (QModelIndex)
  index of the parent item

Return:
  requested index

Return Type:
  QModelIndex

#### HistoryMenuModel.mapFromSource

mapFromSource(sourceIndex)

Public method to map an index to the proxy model index.

sourceIndex (QModelIndex)
  reference to a source model index

Return:
  proxy model index

Return Type:
  QModelIndex

#### HistoryMenuModel.mapToSource

mapToSource(proxyIndex)

Public method to map an index to the source model index.

proxyIndex (QModelIndex)
  reference to a proxy model index

Return:
  source model index

Return Type:
  QModelIndex

#### HistoryMenuModel.mimeData

mimeData(indexes)

Public method to return the mime data.

indexes (QModelIndexList)
  list of indexes

Return:
  mime data

Return Type:
  QMimeData

#### HistoryMenuModel.parent

parent(index)

Public method to get the parent index.

index (QModelIndex)
  index of item to get parent

Return:
  index of parent

Return Type:
  QModelIndex

#### HistoryMenuModel.rowCount

rowCount(parent=None)

Public method to determine the number of rows.

parent (QModelIndex)
  index of parent

Return:
  number of rows

Return Type:
  int

Up

## HistoryMostVisitedMenu

Class implementing the most visited history menu.

### Signals

newBackgroundTab(QUrl, str)
  emitted to open a URL in a new background tab
newPrivateWindow(QUrl, str)
  emitted to open a URL in a new private window
newTab(QUrl, str)
  emitted to open a URL in a new tab
newWindow(QUrl, str)
  emitted to open a URL in a new window
openUrl(QUrl, str)
  emitted to open a URL in the current tab

### Derived from

EricModelMenu

### Class Attributes

None

### Class Methods

None

### Methods

HistoryMostVisitedMenu | Constructor
__activated | Private slot handling the activated signal.
prePopulated | Public method to add any actions before the tree.

### Static Methods

None

#### HistoryMostVisitedMenu (Constructor)

HistoryMostVisitedMenu(count, parent=None)

Constructor

count (int)
  maximum number of entries to be shown
parent (QWidget)
  reference to the parent widget

#### HistoryMostVisitedMenu.__activated

__activated(idx)

Private slot handling the activated signal.

idx (QModelIndex)
  index of the activated item

#### HistoryMostVisitedMenu.prePopulated

prePopulated()

Public method to add any actions before the tree.

Return:
  flag indicating if any actions were added

Return Type:
  bool

Up

## HistoryMostVisitedMenuModel

Class implementing a model to show the most visited history entries.

### Derived from

QSortFilterProxyModel

### Class Attributes

None

### Class Methods

None

### Methods

HistoryMostVisitedMenuModel | Constructor
lessThan | Public method used to sort the displayed items.

### Static Methods

None

#### HistoryMostVisitedMenuModel (Constructor)

HistoryMostVisitedMenuModel(sourceModel, parent=None)

Constructor

sourceModel (QAbstractItemModel)
  reference to the source model
parent (QObject)
  reference to the parent object

#### HistoryMostVisitedMenuModel.lessThan

lessThan(left, right)

Public method used to sort the displayed items.

left (QModelIndex)
  index of left item
right (QModelIndex)
  index of right item

Return:
  true, if left is less than right

Return Type:
  bool

Up